﻿<UserControl x:Class="GermaneShanidze.Applications.Jokeri.Views.LobbyUsersView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:res="clr-namespace:GermaneShanidze.Applications.Jokeri.Resources.Text"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    mc:Ignorable="d"
    >
    
    <UserControl.Resources>
        <res:JokeriLobbyText x:Key="LobbyTextResources" />
        <ContentControl x:Key="ParentDataContext" Content="{Binding}" />
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadGridView Name="ActiveUsersGridView"
                             AutoGenerateColumns="False"
                             ShowGroupPanel="False"
                             ItemsSource="{Binding ActiveUsers}" Margin="2,2,2,2"
                             SelectedItem="{Binding SelectedPlayer, Mode=TwoWay}"
                             Background="Transparent"
                             Opacity="0.50"
                             CanUserDeleteRows="False"
                             IsBusy="{Binding IsBusyLoading}"
                             IsReadOnly="True"
                             RowIndicatorVisibility="Collapsed"
                             >
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="RowActivated">
                    <i:InvokeCommandAction Command="{Binding Source={StaticResource ParentDataContext}, Path=Content.InvitePlayerCommand}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <telerik:RadGridView.Columns>
                <telerik:GridViewImageColumn Header="{Binding Source={StaticResource LobbyTextResources}, Path=Photo}" DataMemberBinding="{Binding ProfilePictureUrl}" 
                                             ImageWidth="40" ImageHeight="40" IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="{Binding Source={StaticResource LobbyTextResources}, Path=FirstName}" DataMemberBinding="{Binding FirstName}"
                                            IsReadOnly="True"/>
                <telerik:GridViewDataColumn Header="{Binding Source={StaticResource LobbyTextResources}, Path=LastName}" DataMemberBinding="{Binding LastName}" 
                                            IsReadOnly="True"/>
                <telerik:GridViewDataColumn Header="" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="../Resources/Graphics/facebook-like.jpg" Width="40" Height="40" />
                            <!--<telerik:RadButton Style="{StaticResource RightArrowButton}" CommandParameter="{Binding UserId}" />-->
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</UserControl>
